#!/usr/bin/ruby
require 'net/http'
require 'date'
require 'mysql'

d1 = Date.parse("2011-01-01")
d2 = Date.today

uri = URI("http://ichart.finance.yahoo.com/table.csv?s=AAPL&a=#{d1.month}&b=#{d1.day}&c=#{d1.year}&d=#{d2.month}&e=#{d2.day}&f=#{d2.year}&g=d&ignore=.csv")
res = Net::HTTP.get_response(uri)

if (!res.is_a?(Net::HTTPSuccess)) then
  puts "HTTP error!"
end
puts res.body

